package com.bwie.parkdemo.mvvm.model;

import android.content.Context;

import com.bwie.lib_core.base.BaseEntity;
import com.bwie.lib_core.mvvm.base.BaseModel;
import com.bwie.lib_core.network.HttpRetrofitFactory;
import com.bwie.lib_core.network.HttpType;
import com.bwie.parkdemo.dao.LoginUserServe;
import com.bwie.parkdemo.mvvm.model.entity.AddVisitorEntity;
import com.bwie.parkdemo.mvvm.model.entity.LoginEntity;

import io.reactivex.Observable;
import okhttp3.RequestBody;

/**
 * 添加访客申请Model->访客申请界面数据层操作类
 * */
public class AddVisitorModel extends BaseModel{

    //添加访客申请方法
    @Override
    public Observable<BaseEntity> request(RequestBody... bodyes) {
        Observable<AddVisitorEntity>addVisitor =
                HttpRetrofitFactory.getInstance().factory(HttpType.TOKENINTERFACE)
                .getRetrofit().create(Api.class).requestAddVisitorEntity(bodyes[0]);
        return changeOB(addVisitor);
    }

    //查询本地用户数据
    public LoginEntity.Values requestUser(Context ctx){
        return new LoginUserServe(ctx).selUser();
    }

    @Override
    public void cleared() {

    }
}
